package com.dmjj.login.config;

import com.dmjj.common.util.ScanPool;

/**
 * @author 王丽凯
 * @Description: TODO
 * @Title: ScanCounter
 * @ProjectName dmjj-bigdata
 * @date 2019/3/17
 */
public class ScanCounter implements Runnable {

    private final Long timeout = 7 * 1000L;

    private String token;
    private ScanPool scanPool;

    public ScanCounter(String token, ScanPool scanPool){
        this.token = token;
        this.scanPool = scanPool;
    }

    @Override
    public void run() {
        try {
            Thread.sleep(timeout);
        }catch (Exception e){
            e.printStackTrace();
        }
        notifyPool(token,scanPool);
    }

    public synchronized void notifyPool(String token, ScanPool scanPool){
        if (scanPool!=null){
            scanPool.notifyPool();
        }
    }
}
